package A_Druid;

import org.junit.Test;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Collection;

public class DruidUtilsDemo2 {
    @Test
    public void test1Select() throws SQLException {
        Connection conn = null;
        conn = DruidUtils.getConnection();
        String sql = "select * from emp1";
        PreparedStatement ps = conn.prepareStatement(sql);
        ResultSet rs = ps.executeQuery(sql);
        while (rs.next()){
            Integer eid = rs.getInt("eid");
            String ename = rs.getString("ename");
            String sex = rs.getString("sex");
            Emp1 emp1 = new Emp1(eid, ename, sex);
            System.out.println(emp1);
        }
    }
}
